//
//  RequireViewController.m
//  Recipe
//
//  Created by bing han on 12-7-12.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "RequireViewController.h"
#import "OrderRequire.h"

@interface RequireViewController ()

@end

@implementation RequireViewController
@synthesize require = _require;
@synthesize disherkey = _disherkey;
@synthesize delegate;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
-(void) viewWillAppear:(BOOL)animated{
    OrderRequire *or = [OrderRequire newInstance];
    _require.text = [or.disherRequire objectForKey:_disherkey];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    _require = nil;
    _disherkey = nil;
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

-(IBAction)sureBtn:(id)sender{
    OrderRequire *or = [OrderRequire newInstance];
    [or addRequire:_disherkey require:_require.text];
    [delegate dissmissRequireView];
}

-(IBAction)backBtn:(id)sender{
    [delegate dissmissRequireView];
}

@end
